package servlet.orders;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import model.Orders;
import model.User;
import service.OrdersService;

/**
 * Servlet implementation class orders_list_Servlet
 */
@WebServlet("/orders_list")
public class orders_list_Servlet extends HttpServlet {

	private OrdersService oService = new OrdersService();
	
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		
		User u = (User) request.getSession().getAttribute("user");
		
		List<Orders> list = oService.selectAll(u.getId());
		
		request.setAttribute("ordersList", list);
		
		request.getRequestDispatcher("/orders_list.jsp").forward(request, response);
		
	}

}
